#include "Function.hpp"
#include "EquationSolver.hpp"
#include <iostream>
#include <cmath>

const double Pi = acos(-1.);

class F : public Function {
public:
    double operator() (double x) const {
        return sin(Pi/2-1.24-x*pow(1-pow(x,2),1/2))-x;
    }
};

void solve_fE() {
    std::cout << "equal to Solve sin(Pi/2-1.24-x(1-x^2)^(1/2)-x on [0,1]" << std::endl;
    Bisection_Method solver_f1(F(), 0, 1);
    double x1 = solver_f1.solve();
    printf("the depth of water h is: %.2f \n",x1) ;
}

int main() {
    std::cout << "Question E:" << std::endl;
    solve_fE();
    return 0;
}